home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 12496 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.9 KB

  1. Path: casbah.acns.nwu.edu!muzaffar
  2. From: muzaffar@casbah.acns.nwu.edu (Usman Muzaffar)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: How can I use huge || very small number?
  5. Date: 1 Apr 1996 12:43:56 GMT
  6. Organization: Northwestern University, Evanston IL
  7. Message-ID: <4joj2c$jh2@news.acns.nwu.edu>
  8. References: <315681F3.314D@blue.nowcom.co.kr> <4joh0l$jch@news.acns.nwu.edu> <4joijj$m0h@news.fsu.edu>
  9. NNTP-Posting-Host: casbah.acns.nwu.edu
  10.  
  11. In article <4joijj$m0h@news.fsu.edu>,
  12. Justin C Lloyd <lloyd@upsilon.cs.fsu.edu> wrote:
  13. >On 1 Apr 1996 12:08:53 GMT, Usman Muzaffar (muzaffar@casbah.acns.nwu.edu)
  14. >wrote:
  15. >** In article <315681F3.314D@blue.nowcom.co.kr>,
  16. >** whoever  <whatever@blue.nowcom.co.kr> wrote:
  17. >** >may be it is FAQ but...
  18. >** >how can I compute 10000! or 0.12345......
  19. >
  20. >** 10000! is a very, very big number.
  21. >** I'm not sure it's even representable by standard IEEE fp notation.
  22. >** Any have that formula? 2*pi*e something or another.
  23. >
  24. >
  25. >I'm sorry that I don't remember the location (possibly sunsite.unc.edu?),
  26. >but there was a collection of C snippets/programs that contained a program
  27. >that "calculated" huge factorials by using strings.  I don't recall the
  28. >algorithm, it was quite complicated.  Anyone else know what I'm referring
  29. >to?
  30. >
  31.  
  32. If it's what I'm thinking of, it's not complicated at all.
  33. Essentially, you teach the computer to do math the way we do, never doing 
  34. more than one digit at a time, and just writing lines and lines of numerals
  35. in neat rows. The advantage is in output: it's not that you couldn't write
  36. a bit of code that couldn't calculate 10000!, but getting it from binary
  37. to decimal output is as cumbersome as calculating the value itself.
  38.  
  39. Of course, the down side is that it's very slow, inelegant, and (let's face it)
  40. kind of stupid to get a computer to add the way we do. After all, it's the
  41. very fact that they *don't* do things slowly is what first attracted us. :)
  42.  
  43. -usman
  44.  
  45.  
  46.